import router from '@/router'
import {getCookie} from '@/utils/cookies'
router.beforeEach((to:any, from:any, next:any) => {
	document.title = to.meta.menuTitle
    if (getCookie("admin_token")) {
		if ( to.path === '/login') {
			next('/echarts')
		} else{
			next()
		}
    } else {
        if (to.path === '/login') { //这就是跳出循环的关键
           next()
        } else {
            next('/login')
        }
    } 
})
